package com.fly.springbootTemplate.controller;

import com.fly.springbootTemplate.entity.StudentDetail;
import com.fly.springbootTemplate.entity.dto.StudentDto;
import com.fly.springbootTemplate.service.StudentDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/studentDetail")
public class StudentDetailController {
    @Autowired
    private StudentDetailService studentDetailService;
    @RequestMapping("/addStudentDetail")
    public boolean addStudentDetail(StudentDto studentDto) {
        return studentDetailService.addStudentDetail(studentDto);
    }
    @RequestMapping("/deleteStudentDetail")
    public boolean deleteStudentDetail(Integer sno) {
        return studentDetailService.deleteStudentDetail(sno);
    }
    @RequestMapping("/updateStudentDetail")
    public boolean updateStudentDetail(StudentDto studentDto) {
        return studentDetailService.updateStudentDetail(studentDto);
    }
    @RequestMapping("/getAllStudentDetail")
    public List<StudentDto> getAllStudentDetail() {
        return studentDetailService.getAllStudentDetail();
    }
    @RequestMapping("/getStudentDetailBySno")
    public StudentDto getStudentDetailBySno(Integer sno) {
        return studentDetailService.getStudentDetailBySno(sno);
    }
}
